VERSION 5.00
Begin VB.Form main 
   BackColor       =   &H00FFC0C0&
   Caption         =   "Preset Counter"
   ClientHeight    =   8055
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   10725
   Icon            =   "main.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   Picture         =   "main.frx":0442
   ScaleHeight     =   8055
   ScaleWidth      =   10725
   StartUpPosition =   2  'CenterScreen
   Begin VB.HScrollBar HScroll3 
      Enabled         =   0   'False
      Height          =   255
      LargeChange     =   10
      Left            =   4320
      Max             =   2000
      TabIndex        =   45
      Top             =   3120
      Width           =   1815
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   1000
      Left            =   120
      Top             =   4200
   End
   Begin VB.Frame Frame7 
      BackColor       =   &H00800080&
      Caption         =   "PWM"
      ForeColor       =   &H00FFFFC0&
      Height          =   1575
      Left            =   8040
      TabIndex        =   40
      Top             =   120
      Width           =   2535
      Begin VB.HScrollBar HScroll2 
         Enabled         =   0   'False
         Height          =   255
         LargeChange     =   10
         Left            =   120
         Max             =   500
         Min             =   1
         TabIndex        =   42
         Top             =   720
         Value           =   1
         Width           =   2295
      End
      Begin VB.HScrollBar HScroll1 
         Enabled         =   0   'False
         Height          =   255
         LargeChange     =   10
         Left            =   120
         Max             =   500
         Min             =   1
         TabIndex        =   41
         Top             =   360
         Value           =   1
         Width           =   2295
      End
      Begin VB.Label Label12 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP1"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   1080
         TabIndex        =   43
         Top             =   1200
         Width           =   495
      End
      Begin VB.Shape Shape12 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00C0C0C0&
         Height          =   255
         Left            =   1800
         Shape           =   4  'Rounded Rectangle
         Top             =   1200
         Width           =   255
      End
      Begin VB.Shape Shape11 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         FillColor       =   &H00C0C0C0&
         Height          =   255
         Left            =   600
         Shape           =   4  'Rounded Rectangle
         Top             =   1200
         Width           =   255
      End
   End
   Begin VB.Timer Timer3 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   120
      Top             =   4680
   End
   Begin VB.Frame Frame6 
      BackColor       =   &H00400040&
      Caption         =   "RPM"
      ForeColor       =   &H00C0FFFF&
      Height          =   3495
      Left            =   4080
      TabIndex        =   37
      Top             =   120
      Width           =   2295
      Begin VB.CommandButton Command21 
         Caption         =   "Reset"
         Height          =   255
         Left            =   1320
         TabIndex        =   48
         Top             =   1680
         Width           =   615
      End
      Begin VB.TextBox Text2 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         BeginProperty Font 
            Name            =   "Arial Rounded MT Bold"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C0E0FF&
         Height          =   585
         Left            =   480
         Locked          =   -1  'True
         TabIndex        =   46
         Text            =   "0000"
         Top             =   2280
         Width           =   1215
      End
      Begin VB.TextBox Text1 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         BeginProperty Font 
            Name            =   "Arial Rounded MT Bold"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FFFF&
         Height          =   735
         Left            =   240
         Locked          =   -1  'True
         TabIndex        =   38
         Text            =   "0000"
         Top             =   360
         Width           =   1815
      End
      Begin VB.Label Label14 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP3"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   360
         TabIndex        =   47
         Top             =   1680
         Width           =   495
      End
      Begin VB.Label Label11 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH2"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   960
         TabIndex        =   39
         Top             =   1200
         Width           =   375
      End
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   1
      Left            =   120
      Top             =   5160
   End
   Begin VB.Frame Frame5 
      BackColor       =   &H00400000&
      Caption         =   "Output"
      ForeColor       =   &H00C0FFC0&
      Height          =   1215
      Left            =   5520
      TabIndex        =   26
      Top             =   5640
      Width           =   5055
      Begin VB.Label Label13 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP4"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   4320
         TabIndex        =   44
         Top             =   840
         Width           =   495
      End
      Begin VB.Shape Shape13 
         BackColor       =   &H00404040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   255
         Left            =   4440
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   255
      End
      Begin VB.Label Label9 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP4"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   3360
         TabIndex        =   35
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label8 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP3"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   2280
         TabIndex        =   34
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label7 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP2"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   1320
         TabIndex        =   33
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label6 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "OP1"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   360
         TabIndex        =   32
         Top             =   840
         Width           =   495
      End
      Begin VB.Shape Shape9 
         BackColor       =   &H00404040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   255
         Left            =   3480
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   255
      End
      Begin VB.Shape Shape8 
         BackColor       =   &H00404040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   255
         Left            =   2400
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   255
      End
      Begin VB.Shape Shape7 
         BackColor       =   &H00404040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   255
         Left            =   1440
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   255
      End
      Begin VB.Shape Shape6 
         BackColor       =   &H00404040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   255
         Left            =   480
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   255
      End
   End
   Begin VB.Frame Frame3 
      BackColor       =   &H00404080&
      Caption         =   "Counter"
      ForeColor       =   &H00C0FFFF&
      Height          =   1575
      Left            =   120
      TabIndex        =   24
      Top             =   120
      Width           =   3735
      Begin VB.TextBox Text7 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         BeginProperty Font 
            Name            =   "Arial Rounded MT Bold"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000080FF&
         Height          =   735
         Left            =   240
         Locked          =   -1  'True
         TabIndex        =   25
         Text            =   "000000000"
         Top             =   360
         Width           =   3255
      End
      Begin VB.Label Label10 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH1"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   1680
         TabIndex        =   36
         Top             =   1200
         Width           =   375
      End
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00808000&
      Caption         =   "Preset"
      ForeColor       =   &H00C0E0FF&
      Height          =   1815
      Left            =   120
      TabIndex        =   4
      Top             =   1800
      Width           =   3735
      Begin VB.CommandButton Command20 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   3120
         TabIndex        =   23
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command19 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   2760
         TabIndex        =   22
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command18 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   2400
         TabIndex        =   21
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command17 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   2040
         TabIndex        =   20
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command16 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   1680
         TabIndex        =   19
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command15 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   1320
         TabIndex        =   18
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command14 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   960
         TabIndex        =   17
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command13 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   600
         TabIndex        =   16
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command12 
         Caption         =   "-"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   390
         Left            =   240
         TabIndex        =   15
         Top             =   1320
         Width           =   375
      End
      Begin VB.CommandButton Command11 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   3120
         TabIndex        =   14
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command10 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2760
         TabIndex        =   13
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command8 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2400
         TabIndex        =   12
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command7 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   2040
         TabIndex        =   11
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command6 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1680
         TabIndex        =   10
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command5 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   1320
         TabIndex        =   9
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command4 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   960
         TabIndex        =   8
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command3 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   600
         TabIndex        =   7
         Top             =   240
         Width           =   375
      End
      Begin VB.CommandButton Command2 
         Caption         =   "+"
         BeginProperty Font 
            Name            =   "Arial"
            Size            =   20.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   240
         TabIndex        =   6
         Top             =   240
         Width           =   375
      End
      Begin VB.TextBox Text6 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00000000&
         BeginProperty Font 
            Name            =   "Arial Rounded MT Bold"
            Size            =   27.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0080FF80&
         Height          =   735
         Left            =   240
         Locked          =   -1  'True
         TabIndex        =   5
         Text            =   "000000000"
         Top             =   600
         Width           =   3255
      End
   End
   Begin VB.Frame Frame4 
      BackColor       =   &H000080FF&
      Caption         =   "Power"
      ForeColor       =   &H0080FFFF&
      Height          =   1335
      Left            =   120
      TabIndex        =   2
      Top             =   6480
      Width           =   735
      Begin VB.CommandButton Command9 
         Caption         =   "ON"
         Height          =   495
         Left            =   120
         TabIndex        =   3
         Top             =   720
         Width           =   495
      End
      Begin VB.Shape Shape10 
         BackColor       =   &H000040C0&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         BorderWidth     =   2
         Height          =   135
         Left            =   120
         Shape           =   4  'Rounded Rectangle
         Top             =   360
         Width           =   495
      End
   End
   Begin VB.CommandButton Command1 
      Caption         =   "port"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   5880
      Width           =   735
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00404040&
      Caption         =   "Pulses"
      ForeColor       =   &H00C0E0FF&
      Height          =   1095
      Left            =   5520
      TabIndex        =   0
      Top             =   4440
      Width           =   5055
      Begin VB.Label Label5 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH5"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   4320
         TabIndex        =   31
         Top             =   720
         Width           =   375
      End
      Begin VB.Label Label4 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH4"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   3360
         TabIndex        =   30
         Top             =   720
         Width           =   375
      End
      Begin VB.Label Label3 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH3"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   2280
         TabIndex        =   29
         Top             =   720
         Width           =   375
      End
      Begin VB.Label Label2 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH2"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   1320
         TabIndex        =   28
         Top             =   720
         Width           =   375
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         BackStyle       =   0  'Transparent
         Caption         =   "CH1"
         ForeColor       =   &H00C0FFFF&
         Height          =   255
         Left            =   360
         TabIndex        =   27
         Top             =   720
         Width           =   375
      End
      Begin VB.Shape Shape5 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   135
         Left            =   4320
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape Shape4 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   135
         Left            =   3360
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape Shape3 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   135
         Left            =   2280
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape Shape2 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   135
         Left            =   1320
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   375
      End
      Begin VB.Shape Shape1 
         BackColor       =   &H00000040&
         BackStyle       =   1  'Opaque
         BorderStyle     =   0  'Transparent
         Height          =   135
         Left            =   360
         Shape           =   4  'Rounded Rectangle
         Top             =   480
         Width           =   375
      End
   End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim inp_val, pwr_flg, set_point, set_read, count_sel, sel_flag, output_value
Dim pe_flag, timer_tog, off_time, on_time, rpm_count, rpm_got, rpm_set, rpm_alrm

Private Sub Command1_Click()
port.Show
End Sub

Private Sub Command10_Click()
set_point = set_point + 10
read_it
End Sub
Private Sub Command11_Click()
set_point = set_point + 1
read_it
End Sub

Private Sub Command12_Click()
set_point = set_point - 100000000
read_it
End Sub

Private Sub Command13_Click()
set_point = set_point - 10000000
read_it
End Sub

Private Sub Command14_Click()
set_point = set_point - 1000000
read_it
End Sub

Private Sub Command15_Click()
set_point = set_point - 100000
read_it
End Sub

Private Sub Command16_Click()
set_point = set_point - 10000
read_it
End Sub

Private Sub Command17_Click()
set_point = set_point - 1000
read_it
End Sub

Private Sub Command18_Click()
set_point = set_point - 100
read_it
End Sub

Private Sub Command19_Click()
set_point = set_point - 10
read_it
End Sub

Private Sub Command2_Click()
set_point = set_point + 100000000
read_it
End Sub

Private Sub Command20_Click()
set_point = set_point - 1
read_it
End Sub

Private Sub Command21_Click()
rpm_alrm = 0
Shape8.BackColor = &H404040
outport_value = outport_value And out3off
Out output_port, outport_value
End Sub

Private Sub Command3_Click()
set_point = set_point + 10000000
read_it
End Sub

Private Sub Command4_Click()
set_point = set_point + 1000000
read_it
End Sub

Private Sub Command5_Click()
set_point = set_point + 100000
read_it
End Sub

Private Sub Command6_Click()
set_point = set_point + 10000
read_it
End Sub

Private Sub Command7_Click()
set_point = set_point + 1000
read_it
End Sub

Private Sub Command8_Click()
set_point = set_point + 100
read_it
End Sub

Private Sub Command9_Click()
If pwr_flg = 0 Then
Timer1.Enabled = True
Timer3.Enabled = True
Timer2.Enabled = True
HScroll1.Enabled = True
HScroll2.Enabled = True
HScroll3.Enabled = True
outport_value = outport_value Or out8on ' turn on supply to 373
outport_value = outport_value Or out7on ' turn on supply to 373
Out output_port, outport_value
Shape9.BackColor = &H80FFFF
Shape13.BackColor = &H80FFFF
pwr_flg = 1
Shape10.BackColor = &HFFFF&
Else
pwr_flg = 0
Timer1.Enabled = False
Timer3.Enabled = False
Timer2.Enabled = False
HScroll1.Enabled = False
HScroll2.Enabled = False
HScroll3.Enabled = False
Shape10.BackColor = &H40C0&
start_up
End If
End Sub

Private Sub Form_Load()
start_up
End Sub
Private Sub Form_Unload(Cancel As Integer)
Timer1.Enabled = False
Timer3.Enabled = False
Timer2.Enabled = False
Beep
Out output_port, output_state
Out control_port, control_state
Unload port
End Sub

Private Sub HScroll1_Change()
on_time = HScroll1.Value
End Sub

Private Sub HScroll2_Change()
off_time = HScroll2.Value
End Sub

Private Sub HScroll3_Change()
rpm_set = HScroll3.Value
Text2 = Format(rpm_set, "0000")
End Sub

Private Sub Timer1_Timer() '
'read SEL select bit
inp_val = Inp(input_port)
sel_bit = inp_val And sel_hex
If sel_bit = sel_hex Then
Shape1.BackColor = &HFF&
sel_flag = 1
ElseIf sel_flag = 1 And sel_bit = 0 Then inc_it
Shape1.BackColor = &H40&
sel_flag = 0
Else
Shape1.BackColor = &H40&
sel_flag = 0
End If
'read PE or paper empty bit
inp_val = Inp(input_port)
pe_bit = inp_val And pe_hex
If pe_bit = pe_hex Then
Shape2.BackColor = &HFF&
pe_flag = 1
ElseIf pe_flag = 1 And pe_bit = 0 Then rpm_in
Shape2.BackColor = &H40&
pe_flag = 0
Else
Shape2.BackColor = &H40&
pe_flag = 0
End If
'read ACK bit
inp_val = Inp(input_port)
ack_bit = inp_val And ack_hex
If ack_bit = ack_hex Then
Shape3.BackColor = &HFF&
Else
Shape3.BackColor = &H40&
End If
'read BUSY bit note this bit is inverted due to the port and the dll file
inp_val = Inp(input_port)
busy_bit = inp_val And busy_hex
If busy_bit = busy_hex Then
Shape4.BackColor = &H40&
Else
Shape4.BackColor = &HFF&
End If
'read ERROR bit
inp_val = Inp(input_port)
err_bit = inp_val And err_hex
If err_bit = err_hex Then
Shape5.BackColor = &HFF&
Else
Shape5.BackColor = &H40&
End If
End Sub
Sub read_it()
If pwr_flg = 1 Then
If set_point < 0 Then set_point = 0
If set_point > 999999999 Then set_point = 999999999
set_read = Format(set_point, "000000000")
Text6 = set_read
End If
End Sub

Sub inc_it()
count_sel = count_sel + 1
If count_sel > 999999999 Then
count_sel = 0
End If
Text7 = Format(count_sel, "000000000")
If count_sel > set_point Then
Shape7.BackColor = &H80FFFF
outport_value = outport_value Or out2on
Out output_port, outport_value
Else
Shape7.BackColor = &H404040
outport_value = outport_value And out2off
Out output_port, outport_value
End If
End Sub
 
Private Sub Timer2_Timer()
rpm_got = rpm_count * 60
If rpm_got > 999999999 Then
rpm_got = 0
End If
Text1 = Format(rpm_got, "0000")
If rpm_got > rpm_set Then
Shape8.BackColor = &H80FFFF
rpm_alrm = 1
outport_value = outport_value Or out3on
Out output_port, outport_value
End If
rpm_count = 0
End Sub

Private Sub Timer3_Timer()
If timer_tog = 0 Then
Timer3.Interval = off_time
timer_tog = 1
outport_value = outport_value Or out1on
Out output_port, outport_value
Shape11.BackColor = &HC0FFC0
Shape12.BackColor = &H40&
Shape6.BackColor = &H80FFFF
Else
timer_tog = 0
outport_value = outport_value And out1off
Out output_port, outport_value
Timer3.Interval = on_time
Shape11.BackColor = &H40&
Shape12.BackColor = &HC0FFC0
Shape6.BackColor = &H404040
End If
End Sub

Sub start_up()
Shape1.BackColor = &H40&
Shape2.BackColor = &H40&
Shape3.BackColor = &H40&
Shape4.BackColor = &H40&
Shape5.BackColor = &H40&
port.Combo1 = "&H378"
output_port = port.Combo1.Text
input_port = output_port + 1
control_port = output_port + 2
Beep
sel_bit = 0
ack_bit = 0
set_read = 0
count_sel = 0
pe_bit = 0
err_bit = 0
busy_bit = 0
pwr_flg = 0
inp_val = 0
set_point = 0
Timer1.Enabled = False
Timer3.Enabled = False
Timer2.Enabled = False
HScroll1.Enabled = False
HScroll2.Enabled = False
HScroll3.Enabled = False
HScroll1.Value = 1
HScroll2.Value = 1
HScroll3.Value = 0
Text7 = "000000000"
Text6 = "000000000"
count_1 = 0
sel_flag = 0
pe_flag = 0
reset_it = 0
timer_tog = 0
off_time = 1
on_time = 1
rpm_count = 0
rpm_got = 0
outport_value = outport_value And out8off
outport_value = outport_value And out7off
Shape6.BackColor = &H404040
Shape7.BackColor = &H404040
Shape8.BackColor = &H404040
Shape9.BackColor = &H404040
Shape13.BackColor = &H404040
Out output_port, outport_value
rpm_set = 0
rpm_alrm = 0
End Sub
Sub rpm_in()
rpm_count = rpm_count + 1
End Sub

